﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Cesave.Domain.PermisosModule.Entities;
using Cesave.Domain.Core.Specification;
using Cesave.Domain.PermisosModule.Resources;

namespace Cesave.Domain.PermisosModule.Contracts.Agentes
{
	/// <summary>
	/// 
	/// </summary>
	public class AgenteByGuidSpecification
		: Specification<Agente>
	{

		#region Private properties

		/// <summary>
		/// 
		/// </summary>
		private Guid _agenteGuid;

		#endregion

		#region Constructor

		/// <summary>
		/// 
		/// </summary>
		/// <param name="agenteGuid"></param>
		public AgenteByGuidSpecification(Guid agenteGuid)
		{
			if (agenteGuid == Guid.Empty)
				throw new InvalidOperationException(Messages.exception_InvalidArgument);
			_agenteGuid = agenteGuid;
		}

		#endregion

		#region Specification overrides

		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
		public override System.Linq.Expressions.Expression<Func<Agente, bool>> SatisfiedBy()
		{
			Specification<Agente> specification = new DirectSpecification<Agente>(agentes => agentes.AgenteGuid == _agenteGuid);
			return specification.SatisfiedBy();
		}

		#endregion
	}
}
